
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>login</title>
    <script src="/JD/Public/js/jquery.js"></script>
</head>
<style>
    *{
        padding:0;
        margin:0;
    }
    .login-form{
        width:350px;
        margin:50px auto;
    }
    .login-top{
        height:130px;
    }
    .login-logo,.login-logo>img{
        height:60px;
    }
    h3{
        line-height: 60px;
    }
    .login-input{
        box-sizing: border-box;
        height:40px;
        width:320px;
        border:1px solid #ccc;
        padding-left:95px;
        position: relative;
        margin-bottom:30px;
    }
    .login-input>span{
        position: absolute;
        top:0;
        left:20px;
        display: block;
        width:40px;
        height: 38px;
        line-height: 38px;
    }
    .login-input>input{
        border:none;
        outline: none;
        height:38px;
        font-size: 14px;
    }
    .login-submit>input{
        box-sizing: border-box;
        height:50px;
        width:320px;
        border: none;
        background-color: #ff2e00;
        color: #fff;
        font-size: 18px;
        cursor: pointer;
        border-radius:5px;
    }
    .yanzheng{
        margin-bottom: 15px;


    }
    .yanzheng>input{
        height: 30px;
        margin-top: -5px;

    }
    .yanzheng>img{
        float: right;
        margin-right: 30px;
    }
</style>
<body>
<div class="login-form">
    <form action="#" method="post" name="login_form">
        <div class="login-top">
            <p class="login-logo"><img src="/JD/Public/img/logo.jpg" alt=""></p>
            <h3>后台管理系统登录</h3>
        </div>
        <div class="login-input">
            <span>账号:</span>
            <input type="text" class="admin_user" name="admin_user" placeholder="请输入账号">
        </div>
        <div class="login-input">
            <span>密码:</span>
            <input type="password"  class="psw" name="admin_psd" placeholder="请输入密码">
        </div>
        <div class="yanzheng">
            <span>验证码</span>
            <input  id="captcha" class="captcha" name="captcha" type="text">

            <img src="http://localhost/shop/index.php/Home/Login/verify"  alt="" width="90" height="30" onclick="javascript:this.src='http://localhost/shop/index.php/Home/Login/verify/'+Math.random();;"/>


        </div>
        <div class="login-submit">
            <input type="button" value="立即登录" id="submit">
        </div>
    </form>
</div>
<script>
    $("#submit").click(function(){
        var username=login_form.admin_user.value;
        var psw=login_form.admin_psd.value;
        var captcha=login_form.captcha.value;

    console.log(username);


    $.post("/JD/index.php/Home/Login/checkUser",{username:username,psw:psw,captcha:captcha},function(res) {
        if (res.errNo == 0) {
            //代表登录成功
            location.href = "/JD/index.php/Home/ShowList/";

        } else {
            alert(res.errMsg)
        }
            })
    })
</script>
</body>
</html>
